package cn.xxliang.platapp.controller;

import cn.xxliang.platapp.pojo.dto.NorthSystemInfoDto;
import cn.xxliang.platapp.pojo.entity.NorthSystemInfo;
import cn.xxliang.platapp.pojo.query.NorthSystemInfoQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import cn.xxliang.platapp.common.BaseRespWithData;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/northSystem")
@Api(tags = "上游系统管理")
@Validated
public class NorthSystemController {
    @PostMapping("/add")
    @ApiOperation("添加上游系统信息")
    public BaseRespWithData addNorthSystem(@RequestBody @Valid NorthSystemInfoDto dto) {
        return new BaseRespWithData().code(200).msg("添加成功");
    }

    @GetMapping("/delete")
    @ApiOperation("删除上游系统信息")
    public BaseRespWithData<String> deleteNorthSystem(@RequestParam @NotNull(message = "主键不能为空") String id) {
        return new BaseRespWithData<>().code(200).msg("删除成功");
    }

    @PostMapping("/update")
    @ApiOperation("更新上游系统信息")
    public BaseRespWithData updateNorthSystem(@RequestBody @Valid NorthSystemInfoDto dto) {
        return new BaseRespWithData<>().code(200).msg("更新成功");
    }

    @GetMapping("/get")
    @ApiOperation(value = "查询上游系统信息")
    public BaseRespWithData getNorthSystem(@RequestParam @NotNull(message = "主键不能为空") String id) {
        return new BaseRespWithData<>().code(200).msg("查询成功").data(new NorthSystemInfo());
    }

    @PostMapping("/list")
    @ApiOperation(value = "分页查询上游系统信息")
    public BaseRespWithData pageNorthSystem(@RequestBody @Valid NorthSystemInfoQuery query) {

        return new BaseRespWithData().code(200).msg("分页查询成功").data(new ArrayList<NorthSystemInfo>());
    }
}